<?php
require_once("../data/DataHandler.php");
session_start();

$data_handler = DataHandler::singleton();
$email = $_POST['email'];
$file = "../pdf/$email.pdf";
if (file_exists($file)) {
  echo "<a href = $file>PDF</a>";
} else {
  echo "No PDF";
}

?>
<script src = "../scripts/jquery.js"></script>
<script src = "../scripts/jquery-validation/jquery.validate.js"></script>
<script src = "../scripts/js/jquery-ui-1.8.16.custom.min.js"></script>
<script>
  $(document).ready(function(){
    $("#slider").slider({
      min: 0.0,
      max: 6.0,
      step: 0.1,
      value: 3.0,
      slide: function() {
        $('#value').html($(this).slider("value"));
      },
      change: function() {
        $('#value').html($(this).slider("value"));
      }
    });
    $("#submit").click(function(){
      var val = $('#slider').slider("value");
      var review = $('#review').val();
      var email = "test@gmail.com";
      $.post('review.php', {rating: val, review: review, applicant: email}, function(data){
        alert(data);
      });
    });
  });
</script>
<form id = "reviewForm">
  <fieldset>
    <legend>Review Application</legend>
    <p>
      Review:
      <textarea rows = "5" cols = "20" id = "review" ></textarea>
    </p>
    <p style = "text-align: center;">
      Rating:
      <span id = "value">
        3.0
      </span>
    </p>
    <p id = "slider">
    </p>
    <p>
      <input type = "button" id = "submit" value = "Submit Review" />
    <p>
  </fieldset>
</form>
